package Arr;

public class find {
    public static int find(int[]arr,int n) {
        int left = 0;
        int right = arr.length - 1;
        int k = n;
        int mid = (arr[left] + arr[right]) / 2;
        while (left<=right) {
            if (mid > k) {
                right = mid-1;
            } else if (mid < k) {
                left = mid+1;
            } else {
                return mid;

            }
        }
        return -1;
    }
}
